import json
import requests
from test_case import conftest
import time

class get_booth_info:

    def from_query_booth(self):
        try:
            t = time.time()
            random_time = str(int(t))
            url = conftest.base_url + '/api-zendai/investment/e/investbooth/list'
            data = {
                "pageSize" : 10,
                "pageNum" : 1,
                "mallCode" : "XMBN",
                "effectiveStatus": 2,
                "enableStatus" : 1,
                "randomTime" : random_time,
                "buildingId": "",
                "floorIds": "",
                "boothCode": "",
                "boothLocationRemark": "",
                "boothName": ""
            }
            result = requests.get(url, headers=conftest.fin_header, params=data)
            fin_result = json.loads(result.text)
            if len(fin_result['data']['records']) != 0:
                return fin_result['data']['records'][0]
            else:
                return False
        except BaseException:
            return False


# a = get_booth_info()
# print(a.from_query_booth())
